﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ImageAcquisition
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            Init();
        }

        private void Init()
        {
            // Init header bar
            int iImgTol = 0;
            int iImgSel = 0;
            // TODO: to get total and selected image number
            header.ImageInfo = string.Format(Properties.Resources.ImageInfo, iImgTol, iImgSel);
            string sCurrUser = string.Empty;
            header.Title = Properties.Resources.Title;
            // TODO: get current user
            header.UserInfo = string.Format(Properties.Resources.UserInfo, sCurrUser);

            toolBarLeft.ParentWindow = this;
            toolBarRight.ParentWindow = this;
        }

        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            Key key = e.Key;
            switch(key)
            {
                    // TODO: key down not implemented yet!
                case Key.Escape:
                    break;// Don't exit for main window
                case Key.F1:
                    Utils.ShowHelp();
                    break;
                case Key.F2:
                    break;
                case Key.F3:
                    break;
                case Key.F4:
                    break;
                case Key.F5:
                    break;
                case Key.F6:
                    break;
                case Key.F7:
                    break;
                case Key.F8:
                    break;
                case Key.F11:
                    break;
                case Key.F12:
                    break;
                default:
                    break;
            }
        }

        private void help_Click(object sender, ExecutedRoutedEventArgs e)
        {
            Utils.ShowHelp();
        }

        public Point ImageContainerLeftTop
        {
            get
            {
                // TODO: get imgContainer's position
                Point pt = imgContainer.TranslatePoint(new Point(0, 0), this);
                return pt;
            }
        }

        public Size ImageContainerSize
        {
            get
            {
                // TODO: get imgContainer's position
                Size size = new Size(imgContainer.ActualWidth, imgContainer.ActualHeight);
                return size;
            }
        }
    }
}
